import 'package:flutter/material.dart';
import 'package:flutter_application_1/components/navBar/footerBar/animatedBar.dart';

class BottomBarNavigationPatternExample extends StatefulWidget {
 List<BarItem> barItems;

  BottomBarNavigationPatternExample({Key? key, required this.barItems})
      : super(key: key);

  @override
  _BottomBarNavigationPatternExampleState createState() =>
      _BottomBarNavigationPatternExampleState();
}

class _BottomBarNavigationPatternExampleState
    extends State<BottomBarNavigationPatternExample> {
  int selectedBarIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: AnimatedContainer(
        color: widget.barItems[selectedBarIndex].color,
        duration: const Duration(milliseconds: 300),
        child: widget.barItems[selectedBarIndex].content,
      ),
      bottomNavigationBar: AnimatedBottomBar(
          barItems: widget.barItems,
          animationDuration: const Duration(milliseconds: 150),
          barStyle: BarStyle(fontSize: 20.0, iconSize: 30.0),
          onBarTap: (index) {
            setState(() {
              selectedBarIndex = index;
            });
          }),
    );
  }
}
